﻿@{
    ViewBag.Title = "商品转链";

}
@section Styles{
    <link href="~/Content/zk/css/public.css" rel="stylesheet" />
    <link href="~/Content/zk/css/tgyj.css" rel="stylesheet" />
    <style>
        .pop_header {
            height: 40px;
            background: -webkit-linear-gradient(top,#f7f7f7,#eee);
            width: 100%;
            border-top-left-radius: 10px;
            border-top-right-radius: 10px;
            line-height: 40px;
            position: relative;
            left: 0;
            top: 0;
        }

            .pop_header p {
                padding-left: 20px;
                font-size: 16px;
                font-weight: bold;
                color: #999;
            }

            .pop_header span {
                background: url(http://0d077ef9e74d8.cdn.sohucs.com/qqjboAO_png);
                width: 15px;
                height: 15px;
                position: absolute;
                right: 20px;
                top: 50%;
                margin-top: -8px;
                background-size: 100%;
                z-index: 999;
            }

            .pop_header img {
                position: absolute;
                right: 50px;
                top: 50%;
                margin-top: -12px;
            }

        .pop_center {
            padding: 10px;
        }

        .pop_detail_title img {
            width: 100px;
            height: 100px;
            float: left;
        }

        .pop_detail_title h6 {
            display: block;
            padding: 5px 5px 0 5px;
            font-size: 12px;
            font-weight: bold;
            color: #333;
            word-break: break-all;
            line-height: 20px;
            height: 50px;
            overflow: hidden;
        }

        .pop_detail .tao {
            background: url(http://0d077ef9e74d8.cdn.sohucs.com/qn4L0QM_png) no-repeat;
            width: 41px;
            height: 15px;
            background-size: 100%;
            margin-top: 3px;
            margin-right: 4px;
        }

        .pop_detail .tianmao {
            background: url(http://0d077ef9e74d8.cdn.sohucs.com/qn4LaFg_png) no-repeat;
            width: 41px;
            height: 15px;
            background-size: 100%;
            margin-top: 3px;
            margin-right: 4px;
        }

        .pop_detail {
            padding: 0 10px;
            line-height: 20px;
            margin-top: 10px;
        }

            .pop_detail .theme {
                color: #555;
            }

            .pop_detail .xian {
                font-size: 18px;
                font-family: georgia,sans-serif;
                color: #e74c3c;
            }

            .pop_detail .yuan {
                font-size: 14px;
                text-decoration: line-through;
                font-family: georgia,sans-serif;
                color: #999;
                margin-left: 10px;
            }

            .pop_detail .youhui {
                font-size: 18px;
                color: #4e9cec;
                font-family: georgia,sans-serif;
            }

            .pop_detail .yongjin {
                font-size: 18px;
                color: #2ecc71;
                font-family: georgia,sans-serif;
            }

            .pop_detail b {
                color: #e74c3c;
                padding: 0 5px;
            }

            .pop_detail .j_btn {
                width: 23%;
                margin-right: 1%;
                height: 24px;
                line-height: 24px;
                text-align: center;
                color: #fff;
                display: block;
                white-space: normal;
                padding: 0px 0px;
                border-radius: 3px;
                -webkit-transition: border .2s linear,color .2s linear,width .2s linear,background-color .2s linear;
                -o-transition: border .2s linear,color .2s linear,width .2s linear,background-color .2s linear;
                transition: border .2s linear,color .2s linear,width .2s linear,background-color .2s linear;
            }

                .pop_detail .j_btn.red {
                    background-color: #f96868;
                    border-color: #f96868;
                }

                .pop_detail .j_btn.green {
                    background: #36ab7a;
                    border: 1px solid #36ab7a;
                }

                .pop_detail .j_btn.gray {
                    background: #76838f;
                    border: 1px solid #76838f;
                }

                .pop_detail .j_btn.waming {
                    background: #e79857;
                    border: 1px solid #e79857;
                    display: none;
                }

            .pop_detail textarea {
                display: block;
                width: 100%;
                height: 100px;
                color: #555;
                font-size: 12px;
                resize: none;
                border: 0;
                background: 0;
                word-break: break-all;
                background: rgba(0,0,0,0.1);
            }
 
        .textareablock {
            margin: 10px;
        }

        .input, .textarea, .select, .inputdl, .textareablock-inner {
            color: #555;
            background-color: #fff;
            border: #ccc 1px solid;
            padding: 5px 10px;
            border-radius: 3px;
            box-shadow: inset 1px 1px 3px rgba(0,0,0,0.05);
        }

        .textareablock textarea {
            border: 0;
            color: #000;
            width: 100%;
            height: 100px;
            font-size: 14px;
            background: transparent;
            resize: none;
        }


        .tao-block2 {
            display: inline-block;
            vertical-align: top;
            width: 49%;
            
        }

       

        .button {
            display: inline-block;
            text-align: center;
            color: #fff;
            border: 0;
            border-bottom: #2980b9 2px solid;
            background: #3498db;
            padding: 8px 15px;
            cursor: pointer;
            border-radius: 5px;
            vertical-align: middle;
            font-weight: bold;
            color: #fff;
            text-shadow: rgba(0,0,0,0.15) 0 1px;
            -webkit-appearance: none;
            -moz-user-select: none;
            -webkit-user-select: none;
            -ms-user-select: none;
            -o-user-select: none;
        }

        .button-red {
            border-color: #fe4f3f;
            background: #fe4f3f;
        }

            .button-red:hover {
                border-color: #fe4f3f;
                background: #fe4f3f;
            }

        .button-full {
            display: block;
            width: 80%;
            margin: auto;
        }
        .line {
            padding: 5px;
        }
    </style>
}
@section Scripts{
 <script src="http://cdn.bootcss.com/layer/3.0.1/layer.min.js"></script>

<script src="~/js/clipboard.min.js"></script>  
     <script>
        function convert(cType) {


            //$('#link').hide();
            //$('#linkRes').show();
            //var txtLink = $('#txt_link').val();
           

            get_list(cType);
        }
        
        function get_list(cType) {
          
            if ($('#txt_link').val()<=0)
            {
                alert("请粘贴链接");
                return false;
            }

            $('#link').hide();
            $('#linkRes').show();
            $.ajax({
                type: "post",
                url: "/AgentCenter/GetSearchLink",
                data: {
                    convertType: cType,
                    link: $('#txt_link').val()
                },
                success: function (data) {
                    if (data.status == 1) {
                        var model = data.DataInfo;
                        var content = '';
                        if (model!=null) {
                            //content += '<li><div class="result-img">';

                            //content += "<a onclick=\"ProductPop('')\" >";
                            //content += '<img src="' + model.pic_url + '_200x200q60.jpg" alt=""></a></div><div class="result-desc">';
                            //content += '<h3 class="f14">' +model.title + '</h3>';
                            //content += '<p class="f13">原价 ¥ <del>' + model.org_price + '</del> 已售' + model.goods_sale + '件</p>';
                            //content += '<p class="f13">券后价 ¥ <strong class="f16">' + model.price + '</strong></p>';
                            //if (model.coupons_price) {
                            //    content += '<p class="f13"><span>券<i>' + model.coupons_price + '元</i></span> 剩余' + model.couponLeftCount + '张</p>';
                            //}
                            //content += "<a onclick=\"\"><button type=\"button\" class=\"f13 sstop\" >我要推广</button></a></div></li>";

                            //content += "<textarea>" + model.text + "</textarea>";
                            /////////////////////////
                            content+='<div class="pop_center">';
                            content+='<div class="pop_detail_title clearfix">';
                            content += '<img src="' + model.pic_url + '_200x200q60.jpg">';
                            content += '<h6>' + model.title + '</h6>';
                            content += '</div><div class="pop_detail clearfix">';
                            if (model.istmall == 1) {
                                content += '<span class="tianmao fl"></span><p class="fl">天猫</p>';
                            }
                            else {
                                content += '<span class="tao fl"></span><p class="fl">淘宝</p>';
                            }
                            content += '</div><div class="pop_detail clearfix"> ';
                            
                            if (model.coupons_price > 0) {
                                content += '<p class="theme fl">价格：</p><p class="fl xian">￥' + model.price + '</p>';
                                content += ' <p class="fl yuan">￥' + model.org_price + '</p>';

                                content += ' </div><div class="pop_detail clearfix"><p class="theme fl">优惠：</p><p class="fl youhui">￥' + model.coupons_price + '</p></div>';
                            }
                            else {
                                content += '<p class="theme fl">价格：</p><p class="fl xian">￥' + model.price + '</p>';
                                content += ' </div><div class="pop_detail clearfix"></div>';
                            }

                         
                          
                            content += ' <div class="pop_detail clearfix"><p class="theme fl">佣金：</p><p class="fl yongjin">￥' + model.concession + '</p>';
                            content += '    <p class="bili">（收入比率<b>' + model.concession_rate + '%</b>）</p></div>';
                            content+='  <div class="pop_detail clearfix"><a href="'+model.url+'" target="_blank" class="fl j_btn red" fqbtbitemid="43545151327">商品链接</a>';
                            content+='<a class="fl j_btn gray" onclick="copy(this)" id="copyid">复制文案</a>';
                           // content+='<a class="fl j_btn waming" onclick="zhuanfa(43545151327)" id="zhuanfa">转发到群</a>';
                            content+='</div><div class="pop_detail clearfix">';
                            content += ' <textarea class="taodetail">'+ model.text + '</textarea>';
                            content+=' </div><div class="pop_detail clearfix"><p></p></div></div>';
                             

                        }
                        $('#link').hide();
                        $("#linkRes").html(content);
                        //if (list.length > 1) {
                        //    $('#sobot').show();
                        //    $('#sobot_index').hide();
                        //} else {
                        //    $('#sobot').hide();
                        //    $('#sobot_index').show();
                        //}
                        

                    }else if (data.status == 2) {
                        layer.open({
                            content: '对不起，没有找到任何优惠！'
                         , btn: ['继续查看']
                         , shadeClose: true
                         , no: function () {
                             window.location.href = '/AgentCenter/ConventLink';
                         }
                        });
                    } else {
                        alert('对不起，没有找到任何优惠！');
                        $('#link').show();
                        $('#linkRes').hide();
                    }

                },
            });


        }
        function copy(obj) {
            $(obj).addClass("btn-success");
            $(obj).addClass("btn-success");
            $(obj).html("已复制");
            var clipboard = new Clipboard('#copyid', {
                text: function (trigger) {
                    return $(".taodetail").val();
                }
            });
            setTimeout(function () {
                $(obj).removeClass("btn-success");
                $(obj).html("复制文案");
            }, 1500);
        }
         

    </script>
    
    }
<div class="person-top back-w" style="max-width:640px">

    <div class="j_box">
        <div class="usertx userNhz " style="background:#fff">
            <div style="width:100%;font-size:16px;padding-left:10px; color:black">推广链接转换<em class="cur"></em></div>
        </div>

        <div id="link" class=" tao-form">
            <input type="hidden" class="input-hidden" name="type" value="wx">
            <div class=" textareablock">
                <div class=" textareablock-inner"><textarea class=" textarea-inner" id="txt_link" name="txt_link" placeholder="要转换的淘宝商品链接"></textarea></div>
            </div>
            <div class="tao-block2">
                <div class=" line"><button onclick="convert(1)" class="button button-full button-red">微信推广</button></div>
            </div>
            <div class="tao-block2">
                <div class=" line"><button onclick="convert(2)" class=" button button-full button-red">QQ推广</button></div>
            </div>
        </div>


        <div id="linkRes" class="number-box color_1"  style="display:none" >
            <div style="text-align: center; padding: 20px; ">
            <img src="~/images/loading.gif" />
                
                <div style="padding-top:10px">正在转换 请稍等 </div>
                </div>
        </div>
    </div>



</div>


<div id="pop">


</div>